<template>
  <div class="banner">
    <el-carousel class="carousel" animation-name="fade" :interval="5000">
      <el-carousel-item v-for="item in carouselItem" :key="item.slogan">
        <div class="carousel-item">
          <div class="carousel-title">{{ item.slogan }}</div>
          <div class="carousel-sub-title">{{ item.subSlogan }}</div>
          <img class="carousel-image" :src="item.image" />
        </div>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script lang="ts" setup>
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import bannerImage from "@/assets/images/welcome.png";

const { t } = useI18n();
const carouselItem = computed(() => [
  {
    slogan: t("login.banner.slogan1"),
    subSlogan: t("login.banner.subSlogan1"),
    image: bannerImage,
  },
  {
    slogan: t("login.banner.slogan2"),
    subSlogan: t("login.banner.subSlogan2"),
    image: bannerImage,
  },
  {
    slogan: t("login.banner.slogan3"),
    subSlogan: t("login.banner.subSlogan3"),
    image: bannerImage,
  },
]);
</script>

<style lang="scss" scoped>
.banner {
  height: 100%;
}
:deep(.el-carousel__container) {
  height: 100%;
}
.carousel {
  height: 100%;

  &-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
  }

  &-title {
    color: white;
    font-weight: 500;
    font-size: 20px;
    line-height: 28px;
  }

  &-sub-title {
    color: white;
    font-size: 14px;
    line-height: 22px;
  }

  &-image {
    width: 320px;
  }
}
</style>
